<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<%@include file="/WEB-INF/views/include/treetable.jsp" %>
	<title>微信自定义菜单管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#treeTable").treeTable({expandLevel : 3});
		});
	</script>
	
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/wechat/wechatMenu/">菜单列表</a></li>
		<shiro:hasPermission name="wechat:wechatMenu:edit"><li><a href="${ctx}/wechat/wechatMenu/form">主菜单</a></li></shiro:hasPermission>
		<li><a href="${ctx}/wechat/wechatMenu/form?id=${wechatMenu.id}&sub=1">子菜单<shiro:hasPermission name="wechat:wechatMenu:edit">${not empty wechatMenu.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="wechat:wechatMenu:edit">查看</shiro:lacksPermission></a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="wechatMenu" action="${ctx}/wechat/wechatMenu/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<label>名称 ：</label><form:input path="name" htmlEscape="false" maxlength="50" class="input-medium"/>
		&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
	</form:form>
	<a href="${ctx}/wechat/wechatMenu/generate?wechatMenu.user.id=${wechatMenu.user.id}" id="btnGenerateMenu" class="btn btn-primary"  >生成微信菜单</a>
	<tags:message content="${message}"/>
	<table id="treeTable" class="table table-striped table-bordered table-condensed">
		<thead><tr><th>菜单名称</th><th>菜单级别</th><th>回复内容</th><th>顺序</th><th>备注</th><shiro:hasPermission name="wechat:wechatMenu:edit"><th>操作</th></shiro:hasPermission></tr></thead>
		<tbody>
		<c:forEach items="${list}" var="wechatMenu">
			<tr id="${wechatMenu.id}"  pId="${wechatMenu.parent.id ne 1?wechatMenu.parent.id:'0'}">
				<td><a href="${ctx}/wechat/wechatMenu/form?id=${wechatMenu.id}<c:if test="${wechatMenu.level eq '1' }">&sub=1</c:if>">${wechatMenu.name}</a></td>
				<td title="${wechatMenu.eventKey }">
					<c:if test="${wechatMenu.level eq '0' }">主菜单</c:if>
					<c:if test="${wechatMenu.level eq '1' }">子菜单</c:if>
				</td>
				<td > 
					<c:if test="${wechatMenu.type eq 'view' }"><a href="${wechatMenu.url }" target="_blank">网址</a></c:if>
					<c:if test="${wechatMenu.type eq 'click' }"  ><span title="回复内容：${wechatMenu.keywords }"> ${wechatMenu.keywords }</span>	</c:if>
				</td>
				<td>${wechatMenu.sort}</td>
				<td>${wechatMenu.remarks}</td>
				<shiro:hasPermission name="wechat:wechatMenu:edit"><td>
    				<a href="${ctx}/wechat/wechatMenu/form?id=${wechatMenu.id}<c:if test="${wechatMenu.level eq '1' }">&sub=1</c:if>">修改</a>
    				<c:if test="${wechatMenu.level eq 0 }"> <a href="${ctx}/wechat/wechatMenu/form?parent.id=${wechatMenu.id}&sub=1">子菜单</a></c:if>
					<a href="${ctx}/wechat/wechatMenu/delete?id=${wechatMenu.id}" onclick="return confirmx('确认要删除该微信自定义菜单吗？', this.href)">删除</a>
					
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	
	
</body>
</html>
